API Documentation
Public Member Functions | List of all members
nkAstraeus::ToneMappingEffect Class Referencefinal

A tone mapping effect meant to map linear values to display device colors. More...

Inheritance diagram for nkAstraeus::ToneMappingEffect:
nkAstraeus::Effect

Public Member Functions

 ToneMappingEffect ()
 
 ~ToneMappingEffect ()
 
virtual EFFECT_TYPE getType () const override
 
nkGraphics::TexturegetSourceTexture () const
 
bool getReinhardUsed () const
 
const nkMaths::VectorgetReinhardMaxWhite () const
 
bool getHablesUsed () const
 
const ToneMappingHablesCurveDescriptorgetHablesDescriptor () const
 
bool getAcesUsed () const
 
const nkMaths::MatrixgetAcesLookTransform () const
 
void setSourceTexture (nkGraphics::Texture *value)
 
void setAsReinhard (const nkMaths::Vector &maxWhite=nkMaths::Vector(2.f, 2.f, 2.f))
 
void setAsHables (const ToneMappingHablesCurveDescriptor &descriptor=ToneMappingHablesCurveDescriptor())
 
void setAsAces (const nkMaths::Matrix &lookTransform=nkMaths::Matrix(1.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 1.f))
 
void setUseLuminance (bool value)
 
virtual bool load () override
 
virtual void unload () override
 
- Public Member Functions inherited from nkAstraeus::Effect
 Effect ()
 
virtual ~Effect ()
 
nkMemory::StringView getName () const
 
nkGraphics::ShadergetShader () const
 
void setName (nkMemory::StringView value)
 

Detailed Description

A tone mapping effect meant to map linear values to display device colors.

This effect offers different algorithms to tone map a given texture to colors that can map on a display device. It is a very important piece to generate realistic looking images, but it can also be tuned to give fancier results.

Constructor & Destructor Documentation

◆ ToneMappingEffect()

nkAstraeus::ToneMappingEffect::ToneMappingEffect ( )

Default constructor. See EffectManager::createOrRetrieve().

◆ ~ToneMappingEffect()

nkAstraeus::ToneMappingEffect::~ToneMappingEffect ( )

Default destructor. See EffectManager::erase().

Member Function Documentation

◆ getType()

virtual EFFECT_TYPE nkAstraeus::ToneMappingEffect::getType ( ) const
overridevirtual
Returns
The effect type, TONE_MAPPING in this case.

Implements nkAstraeus::Effect.

◆ getSourceTexture()

nkGraphics::Texture* nkAstraeus::ToneMappingEffect::getSourceTexture ( ) const
Returns
The source texture used by the effect.

◆ getReinhardUsed()

bool nkAstraeus::ToneMappingEffect::getReinhardUsed ( ) const
Returns
Whether the effect uses the Reinhard technique (true) or not (false).

◆ getReinhardMaxWhite()

const nkMaths::Vector& nkAstraeus::ToneMappingEffect::getReinhardMaxWhite ( ) const
Returns
The max white used by the reinhard algorithm.

◆ getHablesUsed()

bool nkAstraeus::ToneMappingEffect::getHablesUsed ( ) const
Returns
Whether the effect uses the Hables curve technique (true) or not (false).

◆ getHablesDescriptor()

const ToneMappingHablesCurveDescriptor& nkAstraeus::ToneMappingEffect::getHablesDescriptor ( ) const
Returns
The descriptor for the hables curve used.

◆ getAcesUsed()

bool nkAstraeus::ToneMappingEffect::getAcesUsed ( ) const
Returns
Whether the effect uses the ACES standard mapping (true) or not (false).

◆ getAcesLookTransform()

const nkMaths::Matrix& nkAstraeus::ToneMappingEffect::getAcesLookTransform ( ) const
Returns
The look transformation matrix used by the ACES mapping.

◆ setSourceTexture()

void nkAstraeus::ToneMappingEffect::setSourceTexture ( nkGraphics::Texture value)

Sets the texture to use as a source. Linear values are expected in this texture, encoding the light intensities.

Parameters
valueThe texture to tone map as a source.
Remarks
This parameter can be updated without needing the reload the effect if it was already loaded.

◆ setAsReinhard()

void nkAstraeus::ToneMappingEffect::setAsReinhard ( const nkMaths::Vector maxWhite = nkMaths::Vector(2.f, 2.f, 2.f))

Prepare the effect to use the Reinhard technique to tone map the source texture.

Parameters
maxWhiteThe max white point to use as a reference to map the image.
Remarks
If this algorithm is activated when loading the effect, then parameters can be updated without reloading the effect by calling this method again with the new values. However, if the effect was loaded with another algorithm activated, the effect needs to be reloaded for this to be taken into account.

◆ setAsHables()

void nkAstraeus::ToneMappingEffect::setAsHables ( const ToneMappingHablesCurveDescriptor descriptor = ToneMappingHablesCurveDescriptor())

Prepare the effect to use the Hables curve technique to tone map the source texture.

Parameters
descriptorThe description of the curve to use.
Remarks
If this algorithm is activated when loading the effect, then parameters can be updated without reloading the effect by calling this method again with the new values. However, if the effect was loaded with another algorithm activated, the effect needs to be reloaded for this to be taken into account.

◆ setAsAces()

void nkAstraeus::ToneMappingEffect::setAsAces ( const nkMaths::Matrix lookTransform = nkMaths::Matrix(1.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 1.f))

Prepare the effect to use the ACES tone mapping standard.

Parameters
lookTransformA 3x3 transformation matrix that gets applied to the raw ACES values after conversion from the linear reference of the texture. This matrix can be used to tweak the exposure of values, each row encoding a color channel (from the top, red, green, and then blue) output as it gets applied as : lookTransform * acesValues
Remarks
If this algorithm is activated when loading the effect, then parameters can be updated without reloading the effect by calling this method again with the new values. However, if the effect was loaded with another algorithm activated, the effect needs to be reloaded for this to be taken into account.

◆ setUseLuminance()

void nkAstraeus::ToneMappingEffect::setUseLuminance ( bool  value)

Sets whether the effect should act on the luminance values as a whole, or if it will act per color channel.

Parameters
valueWhether the luminance of a pixel should be used (true) or not (false).
Remarks
This parameter requires the effect to to be reloaded if it is changed. It will also not be used for the ACES mapping technique.

◆ load()

virtual bool nkAstraeus::ToneMappingEffect::load ( )
overridevirtual

◆ unload()

virtual void nkAstraeus::ToneMappingEffect::unload ( )
overridevirtual

The documentation for this class was generated from the following file: